﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace testing_thing
{
    class MoveCommand : Command
    {
        public MoveCommand()
            : base(new string[] { "move", "go" }) { }


        public override string Run(Player p, string[] input)
        {
            if (input.Length == 2 && (input[0] == "go" || input[0] == "move")) { return doMove(p, input[1]); }
            return "I don't know how to move that way";
 
        }

        private string doMove(Player p, string id)
        {
            Path pth = p.InLocation.AccessPath(id);
            if (pth ==null)
                return "Cannot proceed " + id;
            p.InLocation = pth.ToLocation;
            return pth.Description+p.InLocation.Title;
        }
    }

    
}
